// classes/pages/chooseclass/index.js
const $api = require("../../../api/class").API

Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var t = this
    t.getInsClassList()
  },
  // 根据机构ID获取班级列表
  getInsClassList() {
    var t = this,
    data ={
      institution_id:wx.getStorageSync('TeacherClassinfo').institution_id
    }
    $api.getInsClassList(data).then(res=>{
      t.setData({
        classlists:res.data

      })
    })
  },
  chooseclass(e){
    var t = this
    wx.setStorageSync('TeacherClassinfo', t.data.classlists[e.currentTarget.dataset.index])
    wx.navigateBack({
      delta: 1,
    })
  }
})